
<template>
  <div class="about">
    <div class="inputbox">
      用户名: <input type="text" v-model="username" /> 密码:
      <input type="text" v-model="passworld" />
    </div>
    <button class="button1" @click="app">登录</button>
    <Bus></Bus>
  </div>
</template>
<script>
import Bus from '@/components/bus.vue'
export default {
  components:{
    Bus
  },
  data() {
    return {
      username: "",
      passworld: "",
    };
  },
  mounted() {

  },
  methods: {
    // 点击之后本地存储用户名密码
    app() {
      if(this.username=="admin" && this.passworld == "123456"){
        sessionStorage.setItem('token',"admin")
        sessionStorage.setItem('tokens',"123456")
        this.$router.push({
          path:'/list',
          query:{name:'张三'}
        })
      }else{
        alert("错误")
      }
    },
  },
};
</script>
<style>
.button1 {
  width: 30%;
  height: 40px;
  margin-top: 20px;
}
</style>
